package com.turn.ttorrent.client;

import com.turn.ttorrent.client.SimpleClient;

import java.net.InetAddress;
import java.net.UnknownHostException;

public class TestClient {
    public static void main(String[] args) throws UnknownHostException {
        // First, instantiate the Client object.
        SimpleClient client = new SimpleClient();

// This is the interface the client will listen on (you might need something
// else than localhost here because other peers cannot connect to localhost).
        InetAddress address = InetAddress.getLocalHost();

//Start download. Thread is blocked here
        try {
            client.downloadTorrent("testDir\\test.txt.torrent",
                    "downloaded\\",
                    address);
            //download finished
            System.out.println("donwload OK");
        } catch (Exception e) {
            //download failed, see exception for details
            e.printStackTrace();
        }
//If you don't want to seed the torrent you can stop client
        //client.stop();
    }
}